import axios from "axios";
const api = "http://localhost:80/api";

//todo НАДО РАЗОБРАТЬ СО СРАНЫМ АКСИОСОМ Я ЕГО ***** ))))

const sendAuth = (email, password) => {
    return axios
        .post(`${api}/login`,
            {
                email : email,
                password: password
            },
        )
        .then(response => {
            console.log("OK sendAuth", response.data);
            return response.data;
        })
        .cath(response => {
            console.log("Error sendAuth", error.response);
            return error.response.data;
        })
};


const sendRegistrInfo = (email, password, passwordConfirm) => {
    return axios
        .post(`${api}/registration`,
            {
                email : email,
                password: password,
                passwordConfirm: passwordConfirm
            },
        )
        .then((res) => {
            console.log("OK UserCars", res.data);
            return res.data;
        })
        .catch((error) => {
            console.log("Error UserCars", error.response);
            return error.response.data;
        });
};
